package com.fysports.web.module.core;

import com.google.common.collect.Lists;
import com.jfinal.core.Controller;
import com.fysports.web.controller.AbstractBaseController;
import com.fysports.web.module.breadcrumb.BreadcrumbModule;
import com.fysports.web.module.menu.RoleMenuModule;

import java.util.List;


/**
 * 模块builder工具
 * Created by konbluesky
 * Date : 14-9-14 下午1:26
 * Project : JdmData_WebServer
 */
public class DefaultModuleBuilder implements IModuleFactory {

    private List<IModule> mList = Lists.newArrayList();


    @Override public IModuleFactory create(Controller ctr) {
        AbstractBaseController abc = (AbstractBaseController) ctr;
        //带权限的菜单builder
                mList.add(new RoleMenuModule(ctr.getRequest()));
//        mList.add(new SystemManagerLeftMenuModule(ctr.getRequest()));
        mList.add(new BreadcrumbModule(ctr.getRequest()));
        abc.setModules(mList);
        return this;
    }


    @Override public IModuleFactory add(IModule module) {
        mList.add(module);
        return this;
    }

}
